import {Routes,Route} from 'react-router-dom'
import routers from './index'

export default function ConfigRouter(){
    const routerFun = (menu:any) =>{
        return  menu.map((item:any,index:any)=>{
            return <Route path={item.path} element={<item.element/>} key={index}>
                {item.children && routerFun(item.children)}
            </Route>
        })
    }
    const routerAll = routerFun(routers)
    return (
        <Routes>
            {routerAll}
        </Routes>
    )
}